package org.spider.model;

import org.springframework.util.StringUtils;

/**
 * @author 15911
 */

public enum HttpMethodEnum {

    // get请求
    GET,
    // head请求
    HEAD,
    // post
    POST,
    // put请求
    PUT,
    // delete请求
    DELETE,
    // trace请求
    TRACE,
    // connect请求
    CONNECT;

    public static HttpMethodEnum match(String name) {
        if (!StringUtils.hasText(name)) {
            return null;
        }
        for (HttpMethodEnum httpMethodEnum : HttpMethodEnum.values()) {
            if (StringUtils.pathEquals(name, httpMethodEnum.name())) {
                return httpMethodEnum;
            }
        }
        return null;
    }
}
